/*
 * DTOCliente.cpp
 *
 *  Created on: Oct 23, 2011
 *      Author: gonzalo
 */

#include "DTOCliente.h"

DTOCliente::DTOCliente(std::string& aDeserealizar,std::string owner): DTO(CLIENTE,owner) {
	deserializar(aDeserealizar);
}

DTOCliente::DTOCliente(std::string owner,std::string clienteId,ClientStatus status,int posX,int posY,int angle) : DTO(CLIENTE,owner){
	this->status = status;
	this->clienteId = clienteId;
	this->posX = posX;
	this->posY = posY;
	this->angle = angle;
}

DTOCliente::~DTOCliente() {
}

std::string DTOCliente::serializar(){
	std::stringstream retorno;
	retorno << UtilString::TOlenghtStringStringValue(clienteId);
	retorno << UtilString::TOlenghtStringStringValue(status);
	retorno << UtilString::TOlenghtStringStringValue(posX);
	retorno << UtilString::TOlenghtStringStringValue(posY);
	retorno << UtilString::TOlenghtStringStringValue(angle);

	return retorno.str();
}
ClientStatus DTOCliente::getStatus(){
	return status;
}

int DTOCliente::getPosX(){
	return posX;
}

int DTOCliente::getPosY(){
	return posY;
}

int DTOCliente::getAngle(){
	return angle;
}

std::string DTOCliente::getClientId(){
	return clienteId;
}

void DTOCliente::deserializar(std::string& string){
	clienteId = UtilString::FROMlenghtStringStringValue(string);
	status = (ClientStatus)(UtilString::stringToInt(UtilString::FROMlenghtStringStringValue(string)));
	posX = UtilString::stringToInt(UtilString::FROMlenghtStringStringValue(string));
	posY = UtilString::stringToInt(UtilString::FROMlenghtStringStringValue(string));
	angle = UtilString::stringToInt(UtilString::FROMlenghtStringStringValue(string));
}

